import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

import i18n from "./lang"

// 注册全局组件
import myPlugin from '@/components'
Vue.use(myPlugin)

// 自定义组件 参要要求对按钮显示隐藏
Vue.directive('allow', {
  // el 当前加自定义指令的组件  binding自定义组件传入的值
  inserted: function (el, binding) {
    const paints = store.state.user.userInfo.roles.points
    if (!paints.includes(binding.value)) {
      el.style.display = "none"
    }
  }

})
// 注册ElementUI并配置语言包
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
